#import "WonderYonderController.h"
        
#import "WonderYonderModel.h"
#import "WonderYonderCell.h"
#import "Masonry.h"

@interface WonderYonderController () <UICollectionViewDataSource, UICollectionViewDelegate>

@property (nonatomic, strong) UICollectionView *hummingbirdCollectionView;
@property (nonatomic, strong) NSMutableArray *pirateArr;

@end

@implementation WonderYonderController

- (void)viewWillAppear:(BOOL)animated {
    [super viewWillAppear:animated];
}

- (void)viewDidLoad {
    [super viewDidLoad];

    [self infiniteConfigsui];
	[self xenophobeZealfetchData];
}


//: 获取数据模型
- (void)xenophobeZealfetchData {
	
}

//: 懒加载数据模型数组
- (NSMutableArray *)pirateArr {
	if (!_pirateArr) {
		_pirateArr = [NSMutableArray array];
	}
	return _pirateArr;
}

- (void)infiniteConfigsui {
    UICollectionViewFlowLayout *quiver = [[UICollectionViewFlowLayout alloc] init];
    quiver.minimumLineSpacing = 10;
    quiver.minimumInteritemSpacing = 10;
    quiver.itemSize = CGSizeMake(100, 100);
    quiver.scrollDirection = UICollectionViewScrollDirectionVertical;
    
    self.hummingbirdCollectionView = [[UICollectionView alloc] initWithFrame:self.view.bounds collectionViewLayout:quiver];
    self.hummingbirdCollectionView.backgroundColor = UIColor.clearColor;
    self.hummingbirdCollectionView.delegate = self;
    self.hummingbirdCollectionView.dataSource = self;
    self.hummingbirdCollectionView.showsHorizontalScrollIndicator = NO;
    self.hummingbirdCollectionView.showsVerticalScrollIndicator = NO;
    [self.hummingbirdCollectionView registerClass:[WonderYonderCell class] forCellWithReuseIdentifier:NSStringFromClass([WonderYonderCell class])];
    
    [self.view addSubview:self.hummingbirdCollectionView];
    [self.hummingbirdCollectionView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.edges.equalTo(self.view);
    }];
}

#pragma mark - UICollectionView DataSource
- (NSInteger)collectionView:(UICollectionView *)collectionView numberOfItemsInSection:(NSInteger)section {
    return self.pirateArr.count;
}

- (UICollectionViewCell *)collectionView:(UICollectionView *)collectionView cellForItemAtIndexPath:(NSIndexPath *)indexPath {
    WonderYonderCell *luminousAppleLaughter = [collectionView dequeueReusableCellWithReuseIdentifier:NSStringFromClass([WonderYonderCell class]) forIndexPath:indexPath];
    return luminousAppleLaughter;
}

#pragma mark - UICollectionView Delegate
- (void)collectionView:(UICollectionView *)collectionView didSelectItemAtIndexPath:(NSIndexPath *)indexPath {
    //: collectioncell 点击
}


@end
